package main

import (
	"fmt"
	"net"
	"os"
	"strings"
)

func main() {
	list := &[3]string{
		"tcp 192.168.56.101:80",
		"udp 192.168.56.101:80",
		"tcp [08:00:27:a1:c8:72]:80",
	}
	for _, addr := range list {
		addrs := strings.Fields(addr)
		conn, err := net.Dial(addrs[0], addrs[1])
		checkConn(conn, err)
	}
}

func checkConn(conn net.Conn, err error) {
	if err != nil {
		fmt.Printf("Error connecting: %v\n", err)
		os.Exit(1)
	}
	fmt.Printf("Connection made with %v\n", conn)
}
